home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lantools
/
blueprnt
/
bplptdef.asm
< prev
next >
Wrap
Assembly Source File
|
1989-11-27
|
5KB
|
168 lines
;************************************************************
;* BP-LAN Remote Printer Installation Utility(BPLPTDEF.ASM) *
;* by Craig Chaiken *
;* November 28, 1989 *
;* *
;* Function: Installs Remote Network Printer *
;* *
;* Command Format: *
;* BPLPTDEF /socket_num /local_printer /remote_printer *
;* /time_out *
;************************************************************
;
codeseg segment
assume cs:codeseg,ds:codeseg,es:codeseg
org 100h
start: jmp intinst
include bpbioshd.mod
include misc.mod
;*** Variables ***
;
old_int17h_vector label dword
old_int17h_offs dw ?
old_int17h_seg dw ?
old_int21h_vector label dword
old_int21h_offs dw ?
old_int21h_seg dw ?
socket_num db 0
local_printer db 0
remote_printer db 0
packet_buffer db 6 dup (0)
time_out db 40 ;40 seconds of retrying for busy printer
retry_count db ?
;*****************************
;*** New Interrupt Handler ***
;*****************************
new_int17h proc far
cmp dl,cs:local_printer
jz new_1
jmp cs:old_int17h_vector
new_1: push bx
push cx
push dx
push si
push di
push ds
push es
push ax
push cs ;Copy CS into DS
pop ds
mov cl,time_out
shr cl,1
mov retry_count,cl ;retry count=time_out / 2
mov cx,4
cmp ah,0
jz new_2
dec cx
new_2: mov packet_buffer,'P'
mov packet_buffer+1,ah
mov ah,remote_printer
mov packet_buffer+2,ah
mov packet_buffer+3,al
put_packet socket_num,cx,offset packet_buffer
get_packet socket_num,cx,offset packet_buffer
cmp packet_buffer,255
jnz new_3
call wait_a_sec
call wait_a_sec
dec retry_count
jnz new_2
new_3: pop ax
mov ah,packet_buffer
pop es
pop ds
pop di
pop si
pop dx
pop cx
pop bx
iret
new_int17h endp
new_int21h proc far
pushf
cmp ah,40h ;writing to device
jz new_i2
popf
jmp cs:old_int21h_vector
new_i2: cmp bx,4 ;printer handle?
jz new_i3
popf
jmp cs:old_int21h_vector
new_i3: cmp cs:remote_printer,0 ;LPT1?
jz new_i4
popf
jmp cs:old_int21h_vector
new_i4: cld
push cx
push dx
push si
xor dx,dx
jcxz new_i6
new_i5: lodsb
mov ah,0
int 17h
loop new_i5
new_i6: pop si
pop dx
pop cx
mov ax,cx
popf
clc
sti
ret 2
new_int21h endp
;*************************************
;*** Install New Interrupt Handler ***
;*************************************
intinst proc near
mov al,cs:[80h]
or al,al
jz default
mov si,81h
call get_opt ;get socket_num
jb default
mov socket_num,cl
call get_opt ;get local printer number
jb default
mov local_printer,cl
call get_opt ;get remote printer number
jb default
mov remote_printer,cl
call get_opt ;get time out in seconds
jb default
mov time_out,cl
default: mov ah,35h ; get interrupt vector function
mov al,17h
int 21h
mov old_int17h_offs,bx ; save old interrupt
mov old_int17h_seg,es ; address
mov ah,25h ; set interrupt vector function
mov al,17h
mov dx,offset new_int17h ; point to new routine
int 21h
mov ah,35h ; get interrupt vector function
mov al,21h
int 21h
mov old_int21h_offs,bx ; save old interrupt
mov old_int21h_seg,es ; address
mov ah,25h ; set interrupt vector function
mov al,21h
mov dx,offset new_int21h ; point to new routine
int 21h
lea dx,intinst
int 27h
intinst endp
codeseg ends
end start
;************************************************************
;* End of Interrupt Handler Installation Module *
;************************************************************